<template>
	<view>
		<view class="side-navbar">
			<view class="side-navbar-wrapper">
				<!-- Sidebar Header    -->
				<view class="sidenav-header">
					<image mode='widthFix' src="/static/logo.png"></image>
				</view>
				<view class="gs">
					<view style="line-height: 22px;margin: 0px 0px 5px 0px;">admin</view>
					<view class="tc"><a @click="logout()">退出登录</a></view>
				</view>
				<!-- Sidebar Navigation Menus-->
				<view class="menu" style="margin-top: 30px;">
					<h5 class="sidenav-heading" @click="conso()">
						<i class="ri-home-fill" style="color:#7800BE;font-size:14px;"></i>
						控制台
					</h5>

				</view>
				<view class="main-menu">
					<!-- 	<h5 class="sidenav-heading">
						<i class="ri-logout-circle-r-fill" style="color:#7800BE;font-size:14px;"></i>
						废旧回收管理
					</h5> -->
					<ul id="side-main-menu" class="side-menu list-unstyled">
						<!-- <li><a @click="fuwulist()"><i-icon size="20upx" color="#7800BE" name="rainbow-fill"></i-icon>常规服务</a></li> -->
						<li><a @click="fjhs()">
								<i class="ri-arrow-right-s-line" style="color:#666;font-size:12px;"></i>
								<!-- <i-icon size="20upx" color="#666" name="arrow-right-s-line"></i-icon> -->
								废旧回收
							</a></li>
					</ul>
				</view>
				<view class="menu">
					<!-- <h5 class="sidenav-heading">
						<i class="ri-home-6-fill" style="color:#7800BE;font-size:14px;"></i>
						站点管理
					</h5> -->
					<ul id="side-menu" class="side-menu list-unstyled">
						<li><a @click="zdlist()">
								<i class="ri-arrow-right-s-line" style="color:#666;font-size:12px;"></i>
								<!-- <i-icon size="20upx" color="#666" name="arrow-right-s-line"></i-icon> -->
								站点管理
							</a></li>
						<li><a @click="zzlist()">
								<i class="ri-arrow-right-s-line" style="color:#666;font-size:12px;"></i>
								<!-- <i-icon size="20upx" color="#666" name="arrow-right-s-line"></i-icon> -->
								站长管理
							</a></li>
						<li><a @click="wuye()">
								<i class="ri-arrow-right-s-line" style="color:#666;font-size:12px;"></i>
								<!-- <i-icon size="20upx" color="#666" name="arrow-right-s-line"></i-icon> -->
								物业管理
							</a></li>
						<li><a @click="user()">
								<i class="ri-arrow-right-s-line" style="color:#666;font-size:12px;"></i>
								<!-- <i-icon size="20upx" color="#666" name="arrow-right-s-line"></i-icon> -->
								用户管理
							</a></li>
						<li><a @click="toGuiminMarketBusinessAuth()">
								<i class="ri-arrow-right-s-line" style="color:#666;font-size:12px;"></i>
								<!-- <i-icon size="20upx" color="#666" name="arrow-right-s-line"></i-icon> -->
								桂民市集商户认证
							</a></li>
					</ul>
				</view>

				<view class="menu">
					<h5 class="sidenav-heading">
						<i class="ri-pie-chart-2-fill" style="color:#7800BE;font-size:14px;"></i>
						订单管理
					</h5>
					<ul id="side-menu" class="side-menu list-unstyled">
						<li><a @click="order()">
								<i class="ri-arrow-right-s-line" style="color:#666;font-size:12px;"></i>
								便民服务订单
							</a></li>
						<li><a @click="orderfj()">
								<i class="ri-arrow-right-s-line" style="color:#666;font-size:12px;"></i>
								废旧回收订单
							</a></li>
						<li><a @click="ordercw()">
								<i class="ri-arrow-right-s-line" style="color:#666;font-size:12px;"></i>
								财务流水订单
							</a></li>
						<li><a @click="orderbz()">
								<i class="ri-arrow-right-s-line" style="color:#666;font-size:12px;"></i>
								集市展位订单
							</a></li>
					</ul>
				</view>
				<view class="menu">
					<ul id="side-menu" class="side-menu list-unstyled">

					</ul>
				</view>
			</view>
		</view>
		<view class="page">
			<iframe class="main" :src="tab" id="__show__1" name="content"></iframe>
		</view>
		<login></login>
	</view>
</template>
<script type="text/javascript">
	export default {
		data() {
			return {
				tab: '#/pages/admin/console'
			}
		},
		methods: {
			toGuiminMarketBusinessAuth() {
				this.tab = "#/pages/admin/market-businessauth"
			},
			conso() {
				this.tab = '#/pages/admin/console'
			},
			fuwulist() {
				this.tab = '#/pages/admin/service'
			},
			fjhs() {
				this.tab = '#/pages/admin/fjhs'
			},
			zdlist() {
				this.tab = '#/pages/admin/station'
			},
			zdadd() {
				this.tab = '#/pages/admin/station-add'
			},
			zzlist() {
				this.tab = '#/pages/admin/station-agent'
			},
			zzadd() {
				this.tab = '#/pages/admin/station-agent'
			},
			wuye() {
				this.tab = '#/pages/admin/wuye'
			},
			order() {
				this.tab = '#/pages/admin/order'
			},
			user() {
				this.tab = '#/pages/admin/user'
			},
			orderfj() {
				this.tab = '#/pages/admin/orderfj'
			},
			ordercw() {
				this.tab = '#/pages/admin/ordercw'
			},
			orderbz() {
				this.tab = '#/pages/admin/orderbz'
			},
			logout() {
				let tk = uni.getStorageSync('token');
				if (!tk) {
					uni.showToast({
						icon: 'error',
						title: 'token为空，您的登录状态为空',
						duration: 2500
					})
					setTimeout(function() {
						uni.reLaunch({
							url: '../login/login',
						})
					}, 2500)
				}
				uni.showLoading({})
				uni.request({
					url: this.baseURL + "/logout",
					method: 'GET',
					header: {
						token: uni.getStorageSync('token')
					},
					success: (res) => {
						console.log(res)
						uni.hideLoading()
						if (res.data.success == true) {
							uni.reLaunch({
								url: '../login/login'
							})
						} else {
							uni.reLaunch({
								url: '../login/login'
							})
						}
					},
					fail: (err) => {
						uni.hideLoading()
						console.log(err)
						uni.showToast({
							icon: 'error',
							title: err.message
						})
						uni.reLaunch({
							url: '../login/login'
						})
					}
				})
			}
		},
		onLoad: function() {}
	}
</script>
